// Achievement by G3X / GeXeH - Enjoy
// Version 1.0

// Achievement: Die 50 times by flames.

local killed = achievements.GetValue( "Torched", "total", 0 )

local function PlayerKilled( msg )
	local victim, inflictor, attacker = msg:ReadEntity(), msg:ReadString(), msg:ReadString()
	
	if ( killed != 50 && victim == LocalPlayer() && attacker == "entityflame" or attacker == "env_fire" ) then
			killed = math.Clamp( killed + 1, 0, 50 )
			achievements.Update( "Torched", killed / 50, killed .. "/50" )
			achievements.SetValue( "Torched", "total", killed )
	end
	
	return victim, inflictor, attacker
end

usermessage.AddHook( "PlayerKilled", "Achievements.Torched", PlayerKilled )

achievements.Register( "Torched", "Die by fire 50 times.", "achievements/torched", killed / 50, killed .. "/50" )